import moment from 'moment';

const contractList =[
    {
      "contractId": "1",
      "applyId": "SQ100",
      "orderId": "1",
      "contractErpCode": "01",
      "buyerCode": "01",
      "buyerCodeErp": "01",
      "buyerName": "01",
      "contractStatus": "1",
      "contractWeight": 1,
      "contractAmount": 11,
      "contractCanWeight": 11,
      "productType": "1",
      "startDate": 1535385600000,
      "endDate": 1535472000000,
      "remark": "1",
      "tenantId": "1",
      "createBy": "1",
      "createTime": 1535420706000,
      "updateBy": "1",
      "updateTime": 1535420712000,
      "batchNo":"001",
      "cmContractDetailInfoList": [
        {
          "contractDetailId": null,
          "contractId": "1",
          "contractDetailCode": null,
          "depotId": null,
          "depotName": null,
          "productLine": null,
          "productCode": null,
          "productName": null,
          "productType": "1",
          "shopSign": null,
          "pieces": null,
          "weight": null,
          "spec1": null,
          "spec2": null,
          "spec3": null,
          "spec4": null,
          "spec5": null,
          "spec6": null,
          "spec7": null,
          "spec8": null,
          "spec9": null,
          "deliveryType": null,
          "transType": null,
          "deliveryProvince": null,
          "deliveryCity": null,
          "deliveryCounty": null,
          "deliveryAddress": null,
          "consigneeProvince": null,
          "consigneeCity": null,
          "consigneeCounty": null,
          "consigneeAddress": null,
          "arrivingStation": null,
          "specialLine": null,
          "consigneeCode": null,
          "consigneeName": null,
          "remark": "1",
          "tenantId": "1",
          "createBy": "1",
          "createTime": 1535420706000,
          "updateBy": "1",
          "updateTime": 1535420712000,
        },
      ],
    },
    {
        "contractId": "1",
        "applyId": "SQ101",
        "orderId": "1",
        "contractErpCode": "01",
        "buyerCode": "01",
        "buyerCodeErp": "01",
        "buyerName": "01",
        "contractStatus": "1",
        "contractWeight": 1,
        "contractAmount": 11,
        "contractCanWeight": 11,
        "productType": "1",
        "startDate": 1535385600000,
        "endDate": 1535472000000,
        "remark": "1",
        "tenantId": "1",
        "createBy": "1",
        "createTime": 1535420706000,
        "updateBy": "1",
        "updateTime": 1535420712000,
        "batchNo":"001",
        "cmContractDetailInfoList": [
          {
            "contractDetailId": null,
            "contractId": "1",
            "contractDetailCode": null,
            "depotId": null,
            "depotName": null,
            "productLine": null,
            "productCode": null,
            "productName": null,
            "productType": "1",
            "shopSign": null,
            "pieces": null,
            "weight": null,
            "spec1": null,
            "spec2": null,
            "spec3": null,
            "spec4": null,
            "spec5": null,
            "spec6": null,
            "spec7": null,
            "spec8": null,
            "spec9": null,
            "deliveryType": null,
            "transType": null,
            "deliveryProvince": null,
            "deliveryCity": null,
            "deliveryCounty": null,
            "deliveryAddress": null,
            "consigneeProvince": null,
            "consigneeCity": null,
            "consigneeCounty": null,
            "consigneeAddress": null,
            "arrivingStation": null,
            "specialLine": null,
            "consigneeCode": null,
            "consigneeName": null,
            "remark": "1",
            "tenantId": "1",
            "createBy": "1",
            "createTime": 1535420706000,
            "updateBy": "1",
            "updateTime": 1535420712000,
          },
        ],
      },
  ]

const applyList = [

]

const orderStatus= [
    {
        key:'0',
        name:'新增',
    },
    {
        key:'1',
        name:'确认',
    },
]

function addOrderGoods(req,res){
    console.log(req.body);
    res.json({orderId:`${moment().valueOf()}`})
}

function queryOrderGoods(req,res){
    console.log(req.query);
    const pagination = {
        total:applyList.length,
        pageSize:10,
        current:1,
    }
    res.json({list:applyList,pagination});
}

function importOrderGoods(req,res){
    console.log(req.files);
    res.json({success:true,batchNo:`${moment().valueOf()}`});
}

function deleteApplyById(req,res){
    console.log(req.body);
    res.json({success:true})
}

function getContractList(req,res){
    console.log(req.body);
    const pagination = {
        total:contractList.length,
        pageSize:10,
        current:1,
    }
    res.json({list:contractList,pagination});
}

export default{
    addOrderGoods,
    queryOrderGoods,
    orderStatus,
    importOrderGoods,
    deleteApplyById,
    getContractList,
}